package cn.charlotte.pit.npc.type;

import cn.charlotte.pit.config.NewConfiguration;
import cn.charlotte.pit.npc.AbstractPitNPC;
import cn.charlotte.pit.npc.Skin;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.trait.SkinTrait;

public abstract class SkinNPC extends AbstractPitNPC {

    @Override
    public void initSkin(NPC npc) {
        final String skinValue = NewConfiguration.getConfig().getString(this.getNpcInternalName() + "-npc-skin");
        if (skinValue != null) {
            String signature = NewConfiguration
                    .getConfig()
                    .getString("not-netease-skins." + getNpcInternalName() + "-signature");

            if (!npc.hasTrait(SkinTrait.class)) {
                npc.addTrait(SkinTrait.class);
            }
            SkinTrait skinTrait = npc.getTrait(SkinTrait.class);
            Skin npcSkin = getNpcSkin();

            if (npcSkin == null || npcSkin.getValue() == null) {
                return;
            }
//            skinTrait.setSkinPersistent("custom_skin_name", signature, npcSkin.getValue());
        }
    }
}
